import { request } from '@umijs/max';
import { IRes, IResPage } from '.';

export interface IBusinessProduct {
  classificationId: number;
  content: string;
  createTime: string;
  id: number;
  status: string;
  title: string;
  url: string;
}

export async function apiGetBusinessProductPage(
  params: Partial<IBusinessProduct>,
) {
  return request<IResPage<IBusinessProduct>>('/v1/business/case/study/page', {
    method: 'GET',
    params,
  });
}

export async function apiGetBusinessProductSave(
  params: Partial<IBusinessProduct>,
) {
  return request<IRes<IBusinessProduct>>('/v1/business/case/study/save', {
    method: 'POST',
    data: params,
  });
}

export async function apiGetBusinessProductUpdate(
  params: Partial<IBusinessProduct>,
) {
  return request<IRes<IBusinessProduct>>('/v1/business/case/study/update', {
    method: 'PUT',
    data: params,
  });
}

export async function apiGetBusinessProductDelete(id: number) {
  return request<IRes<boolean>>(`/v1/business/case/study/${id}`, {
    method: 'DELETE',
  });
}
